//
//  WYCStrCardCell.m
//  初试
//
//  Created by 中企互联 on 2017/10/13.
//  Copyright © 2017年 李胜军. All rights reserved.
//

#import "WYCStrCardCell.h"

@implementation WYCStrCardCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    WYCStrCardCell * cell = [tableView dequeueReusableCellWithIdentifier:[WYCStrCardCell ID]];
    if (!cell) {
        cell = [[WYCStrCardCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[WYCStrCardCell ID]];
    }
    
    
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}
//cell控件摆放
- (void)setMember{
    //背景cell
    UIView * backView = [[UIView alloc] init];
    backView.frame = CGRectMake(0, 0, ScreenWidth, 240 * px);
    backView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:backView];
    
    //银行图标
    _bankImageView = [[UIImageView alloc] init];
    _bankImageView.frame = CGRectMake(40 * px, 40 * px, 160 * px, 160 * px);
    _bankImageView.layer.cornerRadius = _bankImageView.width / 2;
    [backView addSubview:_bankImageView];
    
    //银行类型
    _banktypelabel = [[UILabel alloc] init];
    _banktypelabel.frame = CGRectMake(CGRectGetMaxX(_bankImageView.frame) + 30 * px, _bankImageView.y, ScreenWidth / 2, 70 * px);
    _banktypelabel.font = [UIFont systemFontOfSize:MiddleFont];
    [backView addSubview:_banktypelabel];
    
    
    //银行卡号
    _banknumlabel = [[UILabel alloc] init];
    _banknumlabel.frame = CGRectMake(_banktypelabel.x, CGRectGetMaxY(_banktypelabel.frame) + 20 * px, ScreenWidth / 1.2, 70 * px);
    _banknumlabel.textColor = WYCRGBColor(174, 174, 174);
    [backView addSubview:_banknumlabel];
    
    
    self.hideButton = [[UIButton alloc] init];
    self.hideButton.frame = CGRectMake(ScreenWidth - 40 * px - 80 * px, 40 * px + _bankImageView.height / 3, 80 * px, 80 * px);
    [self.hideButton setImage:[UIImage imageNamed:@"me_ishide"] forState:UIControlStateNormal];
    [backView addSubview:self.hideButton];
    
    
}


- (void)setBillmodel:(WYCBillModel *)billmodel
{
    _billmodel = billmodel;
    if ([billmodel.isHideCard isEqualToString:@"1"]) {
        //招商银行
        if ([billmodel.bankId isEqualToString:@"10000"]) {
            //招商银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_zs"];
            
        }else if ([billmodel.bankId isEqualToString:@"10001"]) {
            //工商银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_gs"];
            
        }else if ([billmodel.bankId isEqualToString:@"10002"]) {
            //农业银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_ny"];
            
        }else if ([billmodel.bankId isEqualToString:@"10003"]) {
            //建设银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_js"];
            
        }else if ([billmodel.bankId isEqualToString:@"10004"]) {
            //中国银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_zg"];
            
        }else if ([billmodel.bankId isEqualToString:@"10005"]) {
            //浦发银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_pf"];
            
        }else if ([billmodel.bankId isEqualToString:@"10006"]) {
            //交通银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_jt"];
            
        }else if ([billmodel.bankId isEqualToString:@"10007"]) {
            //民生银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_ms"];
            
        }else if ([billmodel.bankId isEqualToString:@"10008"]) {
            //深圳发展银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_sf"];
            
        }else if ([billmodel.bankId isEqualToString:@"10009"]) {
            //广东发展银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_gf"];
            
        }else if ([billmodel.bankId isEqualToString:@"10010"]) {
            //中信银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_zx"];
            
        }else if ([billmodel.bankId isEqualToString:@"10011"]) {
            //华夏银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_hx"];
            
        }else if ([billmodel.bankId isEqualToString:@"10012"]) {
            //兴业银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_xy"];
            
        }else if ([billmodel.bankId isEqualToString:@"10013"]) {
            
            //广州银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_gz"];
        }else if ([billmodel.bankId isEqualToString:@"10014"]) {
            
            // 江苏银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_jiangsu"];
        }else if ([billmodel.bankId isEqualToString:@"10015"]) {
            
            //上海农村商业银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_shnos"];
        }else if ([billmodel.bankId isEqualToString:@"10016"]) {
            
            //北京银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_bj"];
        }else if ([billmodel.bankId isEqualToString:@"10017"]) {
            
            //渤海银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_other"];
        }else if ([billmodel.bankId isEqualToString:@"10018"]) {
            
            //北京农商银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_bjns"];
        }else if ([billmodel.bankId isEqualToString:@"10019"]) {
            
            //南京银行
            _bankImageView.image = [UIImage imageNamed:@"bank_njbank"];
        }else if ([billmodel.bankId isEqualToString:@"10020"]) {
            
            //光大银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_gd"];
        }else if ([billmodel.bankId isEqualToString:@"10021"]) {
            
            //东亚银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_dy"];
        }else if ([billmodel.bankId isEqualToString:@"10022"]) {
            
            //宁波银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_nb"];
        }else if ([billmodel.bankId isEqualToString:@"10023"]) {
            
            //杭州银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_hz"];
        }else if ([billmodel.bankId isEqualToString:@"10024"]) {
            
            //平安银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_pa"];
        }else if ([billmodel.bankId isEqualToString:@"10025"]) {
            
            //徽商银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_other"];
        }else if ([billmodel.bankId isEqualToString:@"10026"]) {
            
            // 浙商银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_other"];
        }else if ([billmodel.bankId isEqualToString:@"10027"]) {
            
            //上海银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_other"];
        }else if ([billmodel.bankId isEqualToString:@"10028"]) {
            
            // 中国邮政储蓄银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_hs"];
        }else {
            
            //大连银行
            _bankImageView.image = [UIImage imageNamed:@"bank_icon_dl"];
        }
        
        _banktypelabel.text = billmodel.bankName;
        
        
        NSString * lastNumberStr = [NSString stringWithFormat:@"****    ****    ****     %@",billmodel.lastNumber];
        _banknumlabel.text = lastNumberStr;
    }else{
        
        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"当前没有隐藏的卡"];
    }
    
    
}
+(NSString *)ID{
    return @"cell";
}

@end
